<?php

namespace app\interfaces\controller;
use think\Db;
use lib\Page;
use think\View;
use think\Request;
use app\interfaces\model\Information as InformationModel;
use app\interfaces\model\Ad as AdModel;
class Ad
{
    public function information()

    {

        $message_id = Request::instance()->param('mid');



        if (empty($message_id)) throw new Exception('not Empty');



        $model = new AdModel();



        $result = $model->where('id',$message_id)->value('content');



        $view = new View();



        echo $view->fetch('', ['data' => $result]);

    }

    public function page()
    {
        $param = Request::instance()->param();
        $total = count(Db::name('shop')->select());
        $listRows = 10;
        $Page = new Page($total, $listRows, $param);
        $list = Db::name('shop')->order('create_time')->limit($Page->firstRow . ',' . $listRows)->select();
        $pageHtml = $Page->show($list);// 分页显示输__FUNCTION
        halt($pageHtml);
        return view('', ['data' => $list, 'pageHtml' => json($pageHtml)]);
    }



    public function choujing()
    {
        $view = new View();
        echo $view->fetch('');
    }
}